package com.yunti.yntk.activity.record;

import android.view.View;
import android.widget.ImageView;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.PagerAdapter;
import androidx.viewpager.widget.ViewPager;
import com.google.android.material.tabs.TabLayout;
import com.yunti.yntk.R;
import com.yunti.yntk.activity.BaseActivity;
import com.yunti.yntk.activity.record.fragment.LocalRecordFragment;
import com.yunti.yntk.anotation.ViewInject;
import com.yunti.yntk.view.MyPagerAdapter;

import java.util.ArrayList;
import java.util.List;

public class RecordActivity extends BaseActivity {

    @ViewInject(R.id.tabLayout)
    private TabLayout tabLayout;

    @ViewInject(R.id.viewPager)
    private ViewPager viewPager;

    @ViewInject(R.id.back)
    private ImageView back;

    private PagerAdapter pagerAdapter;

    List<Fragment> fragmentList;

    @Override
    public int initLayoutId() {
        return R.layout.activity_record;
    }

    @Override
    public void initView() {
        fragmentList = new ArrayList<>();
        fragmentList.add(new LocalRecordFragment());
        pagerAdapter = new MyPagerAdapter(getSupportFragmentManager(),fragmentList);
        viewPager.setAdapter(pagerAdapter);
        tabLayout.setupWithViewPager(viewPager);
        tabLayout.getTabAt(0).setText("本地记录");
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }

    @Override
    public void initData() {

    }
}
